import Vue from 'vue'
import Component from 'vue-class-component'

@Component
export default class WindowSize extends Vue{
	public windowWidth = window.innerWidth;
	public windowHeight = window.innerHeight;
	public MobileVerification = false;

	mounted() {
		window.addEventListener('resize', this.handleResize);
	}

	beforeDestroy() {
		window.removeEventListener('resize', this.handleResize);
	}

	handleResize() {
		this.MobileVerification =
			window.innerWidth <= 768 ||
			/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
				navigator.userAgent
			);
		this.windowWidth = window.innerWidth;
		this.windowHeight = window.innerHeight;
	}
};